package com.shop2cn.iapi.couponmanage.testcase.old;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.couponmanage.parameter.CreateCouponBean;
import com.shop2cn.iapi.couponmanage.parameter.GetPlatformBatchesByPagingBean;
import com.shop2cn.iapi.couponmanage.parameter.batchinfo2;
import com.shop2cn.iapi.couponmanage.service.CreateCouponCall;
import com.shop2cn.iapi.couponmanage.service.GetPlatformBatchesByPagingCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.CouponShop2cnCallService;
import com.ymttest.business.service.CouponShop2cnMCallService;
import com.ymttest.database.model.couponbatch;
import com.ymttest.database.model.couponconversioncode;
import com.ymttest.database.model.couponusecondition;
import com.ymttest.database.sqlwapper.couponbatchWapper;
import com.ymttest.database.sqlwapper.couponconversioncodeWapper;
import com.ymttest.database.sqlwapper.couponuseconditionWapper;
//import com.ymttest.database.model.YmtCoupon;
//import com.ymttest.database.model.YmtCouponBatch;
//import com.ymttest.database.model.YmtCouponConversionCode;
//import com.ymttest.database.sqlwapper.YmtCouponBatchWapper;
//import com.ymttest.database.sqlwapper.YmtCouponConversionCodeWapper;
//import com.ymttest.database.sqlwapper.YmtCouponWapper;
import com.ymttest.utils.TestDataManager;
/**
*分页获取平台优惠券批次列表信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetPlatformBatchesByPaging{
	private static GetPlatformBatchesByPagingBean getplatformbatchesbypagingBean;
	private static GetPlatformBatchesByPagingCall getplatformbatchesbypagingCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分页获取平台优惠券批次列表信息");
	}

	@Before
	public void caseUp() {
		getplatformbatchesbypagingBean=new GetPlatformBatchesByPagingBean();
		getplatformbatchesbypagingCall=new GetPlatformBatchesByPagingCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getplatformbatchesbypagingCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_001() {
		Logger.start(true,"根据批次编号获取平台优惠券批次列表信息");
		try {
			int userId=TestDataManager.getRandomIntNum(8);
			CouponShop2cnMCallService couponServiceMCallService=new CouponShop2cnMCallService();
			CreateCouponBean createCouponBean=couponServiceMCallService.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall=couponServiceMCallService.createPlatformCoupon(createCouponBean);
			couponServiceMCallService.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			//Map result= new couponbatchWapper().getTop1PlatformLinkCouponInfo().get(0);
			Map result= new couponbatchWapper().getCouponBatchByBatchCode(createCouponCall.getBatchCode()).get(0);
			
			//getplatformbatchesbypagingBean.setBatchCode(result.get("BatchCode").toString());
			getplatformbatchesbypagingBean.setBatchCode(createCouponCall.getBatchCode());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
		
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回RecordCount");

			verifyReturn();
			
			// JIRACONN-10605:获取平台优惠券列表多返回两个字段： 
			//1、couponTotal：批次优惠券总数 
			//2、receivedQuantity：已领取优惠券数量
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
		        
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(Integer.parseInt(result.get("TotalNum").toString()),batchInfo.getCouponTotal(),"验证返回CouponTotal");
		             Logger.verifyEquals(Integer.parseInt(result.get("ReceivedCount").toString()),batchInfo.getReceivedQuantity(),"验证返回ReceivedQuantity");   
		        }

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_002() {
		Logger.start(true,"根据兑换码获取平台优惠券批次列表信息");
		try {
			
			couponconversioncode code = new couponconversioncodeWapper().getTop1().get(0);
			
			getplatformbatchesbypagingBean.setConversionCode(code.getConversionCode());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回RecordCount");

			verifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_003() {
		Logger.start(true,"根据优惠券码获取平台优惠券批次列表信息");
		try {
			CouponShop2cnMCallService CouponShop2cnMCallService = new CouponShop2cnMCallService();
			CreateCouponBean createCouponBean = CouponShop2cnMCallService.setDefaultPlatformCreateCouponBeanForRecieve();
			CreateCouponCall createCouponCall = CouponShop2cnMCallService.createPlatformCoupon(createCouponBean);
			
			String batchCode = createCouponCall.getBatchCode();
			
			String couponcode = new CouponShop2cnCallService().receiveCouponInfo(batchCode, TestDataManager.getRandomIntNum(6));
			getplatformbatchesbypagingBean.setCouponCode(couponcode);
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回Message");

			verifyReturn();
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_004() {
		Logger.start(true,"根据优惠券类型-优惠码获取平台优惠券批次列表信息");
		try {

			getplatformbatchesbypagingBean.setSendType(1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,
			             		batchInfo.getSendType(),
			                     "验证返回SendType1");


		        }
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_005() {
		Logger.start(true,"根据优惠券类型-私有券获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(2);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
			verifyReturn();
				
		    for(int i=0;i<batchList.size();i++)
		    {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(2,
			             		batchInfo.getSendType(),
			                     "验证返回SendType2");
		    }		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_006() {
		Logger.start(true,"根据优惠券方式-领取获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,
			             		batchInfo.getAcquireCouponMethod(),
			                     "验证返回AcquireCouponMethod为1");


		        }		
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_007() {
		Logger.start(true,"根据优惠券方式-兑换获取平台优惠券批次列表信息");
		try {
			
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(2);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			 Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
     
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(2,
			             		batchInfo.getAcquireCouponMethod(),
			                     "验证返回AcquireCouponMethod为2");


		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_008() {
		Logger.start(true,"根据商品限制类型-指定买手获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,batchInfo.getProductLimitType(),
			                     "验证返回ProductLimitType为1");

		        }	
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_009() {
		Logger.start(true,"根据商品限制类型-指定商品获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(2);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		        	 Logger.verifyEquals(2,batchInfo.getProductLimitType(),
		                     "验证返回ProductLimitType为2");
		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_010() {
		Logger.start(true,"根据商品限制类型-指定活动获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(3);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
				Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyActivityIds(),
			                     "验证返回ApplyActivityIds非空");

		        }				
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_011() {
		Logger.start(true,"根据商品限制类型-指定分类获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(4);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyProductCategories(),
			                     "验证返回ApplyProductCategories非空");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_012() {
		Logger.start(true,"根据商品限制类型-指定国家获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(5);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyNotNull(batchInfo.getApplyCountrys(),
			                     "验证返回ApplyCountrys非空");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_013() {
		Logger.start(true,"根据有效期类型-绝对有效期获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(0);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(0,batchInfo.getEffectiveType(),
			                     "验证返回EffectiveType");

		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_014() {
		Logger.start(true,"根据有效期类型-相对有效期获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(1,batchInfo.getEffectiveType(),
			                     "验证返回EffectiveType");

		        }			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_015() {
		Logger.start(true,"根据申请部门获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(4);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
	
		             Logger.verifyEquals(4,batchInfo.getApplyDepartment(),
			                     "验证返回ApplyDepartment");

		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_016() {
		Logger.start(true,"根据创建时间获取平台优惠券批次列表信息");
		try {
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			
			 Date dNow = new Date(); // 当前时间
		        Date dBefore = new Date();
		        Date dAfter = new Date();

		        Calendar calendar1 = Calendar.getInstance(); // 得到日历
		        calendar1.setTime(dNow);// 把当前时间赋给日历
		        calendar1.add(Calendar.DAY_OF_MONTH, -1); // 设置为前一天
		        dBefore = calendar1.getTime(); // 得到前一天的时间

		        Calendar calendar2 = Calendar.getInstance(); // 得到日历
		        calendar2.setTime(dNow);// 把当前时间赋给日历
		        calendar2.add(Calendar.DAY_OF_MONTH, 10); // 设置为后十天
		        dAfter = calendar2.getTime(); // 得到前一天的时间
		        
			getplatformbatchesbypagingBean.setCreateTimeStart(dBefore);
			getplatformbatchesbypagingBean.setCreateTimeEnd(dAfter);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
			
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");
			verifyReturn();
			
			List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
			Logger.verifyEquals(true, Integer.parseInt(getplatformbatchesbypagingCall.getRecordCount())>0, "验证返回Message");
  
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 String batchCode = batchList.get(i).getBatchCode();
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		        	 Map item = new couponbatchWapper().getCouponBatchByBatchCode(batchCode).get(0);
		        	
		        	 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		        	 Date time = formatter.parse(item.get("AddTime").toString());
		         	
		        	Logger.verifyEquals(true, time.after(dBefore), "验证批次创建时间");
		        	Logger.verifyEquals(true, time.before(dAfter), "验证批次创建时间");
				        
		        }	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_017() {
		Logger.start(true,"根据批次编号获取平台优惠券批次列表信息-相对时间是小时EffectiveTimeType=1-JIRACONN-26114");
		try {
			int userId=TestDataManager.getRandomIntNum(8);
			CouponShop2cnMCallService couponServiceMCallService=new CouponShop2cnMCallService();
			CreateCouponBean createCouponBean=couponServiceMCallService.setDefaultPlatformCreateCouponBeanForRecieve();
			createCouponBean.setEffectiveTimeType(1);
			CreateCouponCall createCouponCall=couponServiceMCallService.createPlatformCoupon(createCouponBean);
			couponServiceMCallService.receiveCouponInfo(createCouponCall.getBatchCode(), userId);
			
			//Map result= new couponbatchWapper().getTop1PlatformLinkCouponInfo().get(0);
			Map result= new couponbatchWapper().getCouponBatchByBatchCode(createCouponCall.getBatchCode()).get(0);
			
			//getplatformbatchesbypagingBean.setBatchCode(result.get("BatchCode").toString());
			getplatformbatchesbypagingBean.setBatchCode(createCouponCall.getBatchCode());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
		
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回RecordCount");

			verifyReturn();
			
			// JIRACONN-10605:获取平台优惠券列表多返回两个字段： 
			//1、couponTotal：批次优惠券总数 
			//2、receivedQuantity：已领取优惠券数量
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
		        
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(Integer.parseInt(result.get("TotalNum").toString()),batchInfo.getCouponTotal(),"验证返回CouponTotal");
		             Logger.verifyEquals(Integer.parseInt(result.get("ReceivedCount").toString()),batchInfo.getReceivedQuantity(),"验证返回ReceivedQuantity");   
		        }

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetPlatformBatchesByPaging_018() {
		Logger.start(true,"根据批次编号获取平台优惠券批次列表信息-仅限直播使用-JIRACONN-26114");
		try {
			int userId=TestDataManager.getRandomIntNum(8);
			CouponShop2cnMCallService couponServiceMCallService=new CouponShop2cnMCallService();
			CreateCouponBean createCouponBean=couponServiceMCallService.setDefaultPlatformCreateCouponBeanForRecieve();
			createCouponBean.setLimitLiveProduct(true);
			CreateCouponCall createCouponCall=couponServiceMCallService.createPlatformCoupon(createCouponBean);
			couponServiceMCallService.receiveCouponInfo(createCouponCall.getBatchCode(), userId);

			Map result= new couponbatchWapper().getCouponBatchByBatchCode(createCouponCall.getBatchCode()).get(0);
			
			getplatformbatchesbypagingBean.setBatchCode(createCouponCall.getBatchCode());
			getplatformbatchesbypagingBean.setSendType(-1);
			getplatformbatchesbypagingBean.setAcquireCouponMethod(-1);
			getplatformbatchesbypagingBean.setProductLimitType(-1);
			getplatformbatchesbypagingBean.setEffectiveType(-1);
			getplatformbatchesbypagingBean.setApplyDepartment(-1);
			getplatformbatchesbypagingBean.setPageIndex(1);
			getplatformbatchesbypagingBean.setPageSize(10);
			
			getplatformbatchesbypagingCall.setData(getplatformbatchesbypagingBean);
			getplatformbatchesbypagingCall.callService();			
		
			Logger.verifyEquals("0", getplatformbatchesbypagingCall.getCode(), "验证返回code");
			Logger.verifyEquals("操作成功！", getplatformbatchesbypagingCall.getMessage(), "验证返回Message");

			Logger.verifyEquals("1", getplatformbatchesbypagingCall.getRecordCount(), "验证返回RecordCount");

			verifyReturn();
			
			// JIRACONN-10605:获取平台优惠券列表多返回两个字段： 
			//1、couponTotal：批次优惠券总数 
			//2、receivedQuantity：已领取优惠券数量
			 List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
		        
		        for(int i=0;i<batchList.size();i++)
		        {
		        	 batchinfo2 batchInfo = batchList.get(i);
		        	 
		             Logger.verifyEquals(Integer.parseInt(result.get("TotalNum").toString()),batchInfo.getCouponTotal(),"验证返回CouponTotal");
		             Logger.verifyEquals(Integer.parseInt(result.get("ReceivedCount").toString()),batchInfo.getReceivedQuantity(),"验证返回ReceivedQuantity");   
		        }

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyReturn()
	{
	   List<batchinfo2> batchList = getplatformbatchesbypagingCall.getbatchInfos().getBatchInfos();
        for(int i=0;i<batchList.size();i++)
        {
	   		 String batchCode = batchList.get(i).getBatchCode();
		   	 batchinfo2 batchInfo = batchList.get(i);
	   	     Map item = new couponbatchWapper().getCouponBatchByBatchCode(batchCode).get(0);
   	     
        	 checkcouponbatch(batchInfo,item,batchCode,i);
             checkcouponusecondition(Integer.parseInt(item.get("BatchId").toString()),batchInfo );
        }
	}
	private void checkcouponbatch(batchinfo2 batchInfo,Map item,String batchCode,int i)
	{
		int batchId=Integer.parseInt(item.get("BatchId").toString());
		 Logger.comment("====方法：验证batchId="+batchId+"数据库checkcouponbatch====");
        Logger.verifyEquals(Integer.parseInt(item.get("BatchId").toString()),
        		batchInfo.getBatchId(),
                "验证batchId="+batchId+"的返回BatchCode与数据库中表couponbatch中BatchCode=" + batchCode
                        + "记录中iBatchId字段相同");
        
        Logger.verifyEquals(item.get("BatchCode").toString(),
        		batchInfo.getBatchCode(),
                "验证batchId="+batchId+"的返回BatchCode与数据库中表couponbatch中BatchCode=" + batchCode
                        + "记录中BatchCode字段相同");

     
        if(item.get("EffectiveType")==null)
        {
        	Logger.verifyEquals(0,
        		batchInfo.getEffectiveType(),
                "验证batchId="+batchId+"的返回EffectiveType与数据库中表Ymt_CouponSetting中EffectiveType字段相同");
        }
        else{
        	   Logger.verifyEquals(Integer.parseInt(item.get("EffectiveType").toString()),
               		batchInfo.getEffectiveType(),
                       "验证batchId="+batchId+"的返回EffectiveType与数据库中表Ymt_CouponSetting中EffectiveType字段相同");
        }
        
        if(item.get("EffectiveType")==null)
        {
        	 Logger.verifyEquals(0,
             		batchInfo.getEffectiveValidType(),
                     "验证batchId="+batchId+"的返回EffectiveValidType与数据库中表Ymt_CouponSetting中EffectiveValidType字段相同");
             }
        else
        {
        	 Logger.verifyEquals(Integer.parseInt(item.get("EffectiveValidType").toString()),
             		batchInfo.getEffectiveValidType(),
                     "验证batchId="+batchId+"的返回EffectiveValidType与数据库中表Ymt_CouponSetting中EffectiveValidType字段相同");
        
        }

        Logger.verifyEquals(item.get("ValidStart").toString().subSequence(0, 19),
        		batchInfo.getEffectiveStartTime().replace("T", " "),
                "验证batchId="+batchId+"的返回ValidStart与数据库中表Ymt_CouponSetting中ValidStart字段相同");

        Logger.verifyEquals(item.get("ValidEnd").toString().subSequence(0, 19),
        		batchInfo.getEffectiveEndTime().replace("T", " "),
                "验证batchId="+batchId+"的返回ValidEnd与数据库中表Ymt_CouponSetting中ValidEnd字段相同");
        
        if(item.get("EffectiveDays")==null)
        {
        	Logger.verifyEquals(0,
        		batchInfo.getEffectiveDays(),
                "验证batchId="+batchId+"的返回EffectiveDays与数据库中表Ymt_CouponSetting中EffectiveDays字段相同");
        }
        else {
        	Logger.verifyEquals(Integer.parseInt(item.get("EffectiveDays").toString()),
            		batchInfo.getEffectiveDays(),
                    "验证batchId="+batchId+"的返回EffectiveDays与数据库中表Ymt_CouponSetting中EffectiveDays字段相同");     
		}
        
      
        Logger.verifyEquals(Integer.parseInt(item.get("ReceiveUserType").toString()),
        		batchInfo.getApplyUserType(),
                "验证batchId="+batchId+"的返回BatchCode与数据库中表couponbatch中ReceiveUserType字段相同");
        
        Logger.verifyEquals(item.get("EffectiveTimeType"),
        		batchInfo.getEffectiveTimeType(),
                "验证batchId="+batchId+"的返回BatchCode与数据库中表couponbatch中EffectiveTimeType字段相同");
	}

	 private void checkcouponusecondition(int batchId,batchinfo2 callbatchInfo)
	    {
	    	Logger.comment("====方法：验证batchId="+batchId+"数据库checkcouponusecondition====");
	    	List<couponusecondition> couponuseconditions=new couponuseconditionWapper().selectByBatchId(batchId);
	    	couponbatch couponbatch= new couponbatchWapper().selectByPrimaryKey(batchId);
	    	if(couponuseconditions.size()==0 && couponbatch.getUseConditionType()!=11)
	    	{
	    		if(couponbatch.getUseConditionType()==9)
	    		
					Logger.verifyEquals(9, couponbatch.getUseConditionType(),
		                    "验证限制类型为团长劵时 数据库couponbatch表中UseConditionType=0");
	    		else
	    			Logger.verifyEquals(0, couponbatch.getUseConditionType(),
		                    "验证batchId="+batchId+"的限制类型为通用时 数据库couponbatch表中UseConditionType=0");
	    	}
	           //0:通用 1:指定买手，2：指定商品，3：指定活动，4：指定分类，5：指定国家，6：指定品牌，7：指定国家和分类，8：仅优先商品
	    	//国家和分类
			if(callbatchInfo.getApplyCountrys().isEmpty()==false && callbatchInfo.getApplyProductCategories().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> clist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,5);
				List<couponusecondition> pclist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,4);
				String cstr="";
				String pcstr="";
				for(int i=0;i<clist.size();i++)
				{
				  cstr+=clist.get(i).getConditionValue()+",";	  
				}
				for(int i=0;i<pclist.size();i++)
				{
					pcstr+=pclist.get(i).getConditionValue()+",";	  
				}
				cstr=cstr.substring(0, cstr.length()-1);
				pcstr=pcstr.substring(0, pcstr.length()-1);
				 Logger.verifyEquals(callbatchInfo.getApplyCountrys(), cstr, "验证batchId="+batchId+"的限制类型为指定国家和分类时 返回 Countrys");
				 Logger.verifyEquals(callbatchInfo.getApplyProductCategories(), pcstr, "验证限制类型为指定国家和分类时 返回 ProductCategories");
			    Logger.verifyEquals(7, couponbatch.getUseConditionType(), "验证batchId="+batchId+"的限制类型为指定国家和分类时 数据库couponbatch表中UseConditionType=7");
			    Logger.verifyEquals(7, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
			    return;
			}
			
			//活动和品牌
			if(callbatchInfo.getApplyActivityIds().isEmpty()==false && callbatchInfo.getApplyProductBrands().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> clist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,3);
				List<couponusecondition> pclist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,6);
				String cstr="";
				String pcstr="";
				for(int i=0;i<clist.size();i++)
				{
				  cstr+=clist.get(i).getConditionValue()+",";	  
				}
				for(int i=0;i<pclist.size();i++)
				{
					pcstr+=pclist.get(i).getConditionValue()+",";	  
				}
				cstr=cstr.substring(0, cstr.length()-1);
				pcstr=pcstr.substring(0, pcstr.length()-1);
			    Logger.verifyEquals(callbatchInfo.getApplyActivityIds(), cstr, "验证batchId="+batchId+"的限制类型为指定国家和分类时 返回 ActivityIds");
				Logger.verifyEquals(callbatchInfo.getApplyProductBrands(), pcstr, "验证限制类型为指定国家和分类时 返回 ProductBrands");
			    Logger.verifyEquals(10, couponbatch.getUseConditionType(), "验证batchId="+batchId+"的限制类型为指定国家和分类时 数据库couponbatch表中UseConditionType=7");
			    Logger.verifyEquals(10, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
			    return;
			}
			
			
			//指定买手
			if(callbatchInfo.getApplySellerIds().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,1);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplySellerIds(), str.substring(0, str.length()-1),
	                      "验证batchId="+batchId+"的限制类型为指定买手时 返回SellIds");
 			Logger.verifyEquals(1, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//商品
			if(callbatchInfo.getApplyProducts().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,2);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplyProducts(), str.substring(0, str.length()-1),"验证batchId="+batchId+"的限制类型为指定商品时 返回SpecificProducts");
// 			if(callbatchInfo.getProductLimitType()!=4)
// 			Logger.verifyEquals(2, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			
			//活动
			if(callbatchInfo.getApplyActivityIds().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,3);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplyActivityIds(), str.substring(0, str.length()-1),"验证batchId="+batchId+"的限制类型为活动时 返回ActivityIds");
 			Logger.verifyEquals(3, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//分类
			if(callbatchInfo.getApplyProductCategories().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,4);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplyProductCategories(), str.substring(0, str.length()-1),"验证限制类型为活动时 返回ProductCategories");
 			Logger.verifyEquals(4, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//国家
			if(callbatchInfo.getApplyCountrys().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,5);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplyCountrys(), str.substring(0, str.length()-1),"验证batchId="+batchId+"的限制类型为国家时 返回Countrys");
 			Logger.verifyEquals(5, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//品牌
			if(callbatchInfo.getApplyProductBrands().isEmpty()==false && couponuseconditions.size()!=0)
			{
				List<couponusecondition> cslist=new couponuseconditionWapper().selectByConditionTypeAndBatchId(batchId,6);
				String str="";
				for(int j=0;j<cslist.size();j++){
					
					str+=cslist.get(j).getConditionValue()+",";
				}
 			Logger.verifyEquals(callbatchInfo.getApplyProductBrands(), str.substring(0, str.length()-1),"验证batchId="+batchId+"的限制类型为国家时 返回ProductBrands");
 			Logger.verifyEquals(6, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//优先商品
			if(callbatchInfo.getProductLimitType()==8 &&  couponuseconditions.size()!=0)
			{
				Logger.verifyEquals(8, couponbatch.getUseConditionType(),
	                    "验证batchId="+batchId+"的限制类型为指定优先商品时 数据库couponbatch表中UseConditionType");
				Logger.verifyEquals(8, couponbatch.getUseConditionType(),
	                    "验证batchId="+batchId+"的限制类型为优选商品时 数据库couponbatch表中UseConditionType=8");
				Logger.verifyEquals(8, callbatchInfo.getProductLimitType(), "验证batchId="+batchId+"的返回的ProductLimitType");
				return;
			}
			//仅限直播时使用
			if(callbatchInfo.getProductLimitType()==11)
			{
				Logger.verifyEquals(11, couponbatch.getUseConditionType(),
	                    "验证batchId="+batchId+"的限制类型为仅限直播时使用时 数据库couponbatch表中UseConditionType");
				Logger.verifyEquals(4, couponbatch.getCouponType(),
	                    "验证batchId="+batchId+"的限制类型为仅限直播时使用时 数据库couponbatch表中CouponType");
				Logger.verifyEquals(callbatchInfo.getProductLimitType(), couponbatch.getUseConditionType(),
	                    "验证batchId="+batchId+"的限制类型为仅限直播时使用时 数据库couponbatch表中getUseConditionType 等于返回字段ProductLimitType");
			}
	    }
	 
}